package com.jt.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jt.mapper.ItemCatParamMapper;
import com.jt.pojo.ItemCatParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ItemCatParamServiceImpl implements ItemCatParamService {
    @Autowired
    private ItemCatParamMapper itemCatParamMapper;
    //sql:select * from item_cat_param where itemCatId = xxx and paramType = xxx
    @Override       //参数中进右itemCatId,paramType
    public List<ItemCatParam> findParamListByType(ItemCatParam itemCatParam) {
        return itemCatParamMapper.selectList(new QueryWrapper<>(itemCatParam));

    }

    @Override
    @Transactional
    public void addItemCatParam(ItemCatParam itemCatParam) {
        itemCatParamMapper.insert(itemCatParam);
    }

    @Override
    @Transactional
    public void updateItemCatParam(ItemCatParam itemCatParam) {
        itemCatParamMapper.updateById(itemCatParam);
    }

    @Override
    public void deleteItemCatParamById(Integer paramId) {
        itemCatParamMapper.deleteById(paramId);
    }


}
